package com.behome.netty.netty_A.handler.A50Handler;

import com.behome.netty.netty_A.bean.A50Bean.AdapterHeartBeat;
import com.behome.netty.netty_A.bean.ProtocolAPacket;
import com.behome.netty.netty_A.handler.BusinessAHandlerBase;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;

import java.net.InetSocketAddress;

/**
 * @author bh_ljy
 * @description: 附录A心跳 处理器
 * @date: 2024/3/28 12:05
 */
@Slf4j
public class AdapterHeartBeatHandler extends BusinessAHandlerBase {

    public AdapterHeartBeatHandler(ChannelHandlerContext ctx, ProtocolAPacket msg, int type) {
        super(ctx, msg, type);
    }

    @Override
    public void resolve() {
        try {
            log.debug("当前处理器来自于:   [{}]", type == 0 ? "内网" : "公网");
            AdapterHeartBeat response = (AdapterHeartBeat) this.msg;
            log.debug(response.toCHJsonString());
            InetSocketAddress ipSocket = (InetSocketAddress) this.ctx.channel().remoteAddress();
            String clientIp = ipSocket.getAddress().getHostAddress();
        } catch (Exception e) {
            log.error("心跳解析异常", e);
        }


    }
}
